import configparser

def configReader(section_list):
    # Load the default configuration file in the root path.
    cf = configparser.ConfigParser()
    cf.read('./config.ini')

    # Get all the section name.
    secs = cf.sections()

    # Return data are stored in dict structure.
    result_dict = {}
    
    # scan each section exists in the section_list and parse the corresponding configuration. 
    for section in section_list:
        try:
            options = cf.options(section)
            for config_item in options:
                result_dict[config_item] = cf.get(section, config_item)
        except Exception as e:
            print(e)

    return result_dict

if __name__ == '__main__':
    ret = configReader(['snackAI-Basic', 'snackAI-View'])
    print(ret)
